import os
from dashscope import Generation


# 单轮对话
msgs = [
    {'role': 'user', 'content': '你是谁'}
]

resp = Generation.call(
    api_key=os.getenv("DASH_SCOPE_API_KEY"),
    model="qwen-plus",
    messages=msgs,
    result_format="message"
)

if resp.status_code == 200:
    print(resp.output.choices[0].message.content)
else:
    print("调取错误")
